Everyone that works as software developer has faced the same situation when a software project begins to bring you more than one headache. Sometimes is hard to maintain the motivation while you are developing a software project. The customer do not brings you a clear idea of what does he wants, and you begin to hate reimplementing the same stuff more than one time. Fortunately currently I work with very professional people that is capable to bring me very detailed specs about software projects, and do not happened to me in a long time — at least in two years.
Well, on those projects where you do not meet a valuable customer that wants his product implemented professionally, usually they bring you the requirements as they are water drops, I mean very small pieces of something that you cannot measure because the customer has lack of trust and sometimes do not want to reveal the complete product. Usually those projects are destined to fail, and once you start working on them, you will not be able to have a generalised measurement on the project cost. Even if you can apply agile methodologies, if you attach something like evolutionary agile methodologies, you will not be able to handle the project.
How to keep yourself motivated?. Probably the idea is simple. You can use some object oriented programming principles, like reusability. If you think a little, that project that is making you angry, can be used to extract common problems, solve them, and reuse the standard solutions in future projects, creating libraries that can help you in future product releases. So, you must design and implement your solution as non-disposable software. Disposable software is just disposable, and can solve your problems one time. That project that makes you angry, is just a good opportunity to refactor and to extract common problems from it, just because it requires more time than other projects.
Probably going slow is much faster than trying to be faster to finish the project quickly. You do not need to be in front of the computer every time. Take your time, drink a coffee or a tea, think very well how to solve each problem, walk a little around the office, smoke a cigarette — always thinking on how to solve the problem with software generalisations — and you will be reaching the solution without stress yourself. Building software is about thinking, not dropping lines of code, that is just a part of your work.
Obviously, you cannot think well if you are under pressure. If your boss do not understands that building software is about thinking, your boss probably will want you glued to your desk and doing monkey-patching work. Try to leave that job, it is insane ;)