Are you describing a feeling of: 1) I don't really want to be working on this? or 2) I'm stuck?
I don't want to be workingwork on this
Some people do better with deadlines. Peel off a reasonable chunk of the task and set a deadline. Sharing deadlines with others sometimescan help keep you accountable.
One of my favorite tricks is to start each day with a sheet of paper and make three columns: Must (do today - meetings, calls, etc), Should (work on - looming deadilne) Want (to work on). Under each column divvy up the tasks you have on your mind. From these lists pick three items that you can reasonably accomplish today that will move your pile forward. Knock those three out and everything beyond that is a bonus, ie "I was overproductive today". It takes a little practice to break down the tasks into the right amount, but it's effective.
Breaks are ok, but get a timer (I use an electronic kitchen timer). This can also be used to "Trick" yourself into moving forward as well. Some of mine: "I'll spend the next eight minutes trying to get this test to pass." "I'll spend the next ten minutes adjusting this layout". Or if that feels too short, you can always timebox your tasks.
I'm stuck
Share your pain with others. Just describing the problem often leads to a solution.
Exploratory testing is a great technique for poking at a system you don't understand but have to change.
Take a walk. Distractions are part of the process. Just don't make them your only solution to every problem.