Hi billybraga, that was very much my problem a few weeks ago - I thought I'd never learn the few pieces I'd set myself, particularly the counterpoint of Bach. I'm learning the Two Part Invention No.1 in C (so even easier than 8 or 4, I think). Great advice here so far, as usual. What turned it round for me was:
1. I was playing too fast. Despite knowing that you start slowly and gradually get better, eventually reaching the tempo prescribed or your own interpretation of it, I didn't realise I was pushing it too fast too early. This applies to almost everything (although some pieces can lose their sense so much if you play them very slowly that it's almost worse!).
2. Hands together is not twice as hard, or four times, more like 20 times harder. Bach counterpoint is particularly tricky (in my limited experience).
3. No matter how well I've learned a piece hands separate, it appears not to translate into better HT play (in my limited experience). This was crucial for me, mainly because I struggle a bit with reading (as opposed to learning where I put my fingers and forgetting there's a score in front of me). It was an absolute revelation when I slowed right down...no, even slower!... to the point where I was reading each and every note of both hands. It sounds obvious, but THAT is what the missing bit was - programming my brain to move both hands where they need to go at the same time, and forcing myself to read it properly. That was - as I say - VERY slow. It's a bit like when you're learning a scale and you have to switch position ("thumb under") at different times. It seems to me that only slow practice gets that coordination into my brain. I'm not sure what's happening when I play to fast, but probably I'm watching the more difficult part of the score, whereupon the easier bit messes up, and that means I'm not teaching myself to play it properly, but practising my habitual mistakes.
4. One secret for helping avoid the boredom of playing slowly is to "play" - i.e., this isn't work, it's fun, it's experimentation. I often find that playing something much slower than it's usually played opens up a whole new vista of expression possibilities, and I "play" with those. I imagine this is actually how the composer meant it to be played (and I suspect they often did as they were writing it, but forgot when they got better at it and sped up!). There's been some discussion of how emotional Baroque music "ought" to be, but I take that with a pinch of salt. I'm learning the Aria from the Well Tempered Clavier 1, and I'm amazed how many different phases of emotion it goes through in one piece - either I'm imagining that, or people who don't believe me are stone cold

. Baroque expresses emotion as well in the player's interpretation, particularly in rubato (changes of tempo, little halts and swifter moments) and accenting of notes - phrasing - and that's where I can have so much fun with these while I play them slowly. Many of those interpretive touches also carry over as I increase tempo, and I don't think I'd ever discover them or fit them in later if I blasted through something at high speed.
5. Chunking - as has been said - don't keep practising bits you can play, practise the bits you can't. I play through a piece once in each session, then go back and practise the bits I stuttered over (or I stop playing through and work on those before continuing). Some sessions, if I haven't much time, I just play "those four tricky bars" and call it a day. In order to keep the shape of a piece in mind, I sometimes play the hard bits at a slow pace, then speed up through the bits I can do easily (for instance, in the 2-Piece in C, there are passages where the parts take turns, so it's almost as easy as playing HS).
6. If you have the freedom to choose pieces yourself, do ones you fall in love with. The Aria is "way above my pay grade", but I literally couldn't stop myself trying. I made it my treat after plodding through things I was bored with (before I had my revelation).