Gaaah...I hate it when that happens. For me, it kind of depends on what's going on that makes me realize we aren't connecting. The other day, it was driving me NUTS - I was cueing him for a canter from a walk, but he kept doing leg yields instead. In that case, I just stayed persistent and every time he yielded off the leg from a canter cue, I bumped him with the opposite leg, and we just kept. At. It. A couple of times around the ring until the penny dropped and he said "Oh! A canter? OK." I suspect that if he kept going into the middle of the ring and stopping, my trainer would have instructed me to kick him until he went forward instead, and that once I had him doing that, it would be OK to stop. I can already hear what my trainer would have said if I'd decided to get off Huey if he was pulling that kind of stuff instead of obliging him to cooperate with my master plan...Not saying that's what you should have done with your horse, just saying what would have happened if it had been me + my horse, given my skill level, his skill level, our temperaments, etc. It's complicated, I know.
What I think maybe speaks better to your question is this: I pay very close attention to Huey from the moment I go into his paddock to pick him up, and I can tell if we're communicating or not from that point on. If we aren't going to be communicating, it usually is pretty obvious from the get-go, not something that just crops up midway through a ride. And if (when) I realize that I do not have his full attention and/or cooperation, I don't even get on him until I do. Too dangerous otherwise - he can spook and explode if he's distracted. So I will groom him, and then put him into the round pen and lunge him and do the kind of groundwork it sounds like you did, and if I get his attention focused on me and staying there, *then* I will tack him up and ride. Otherwise, we do groundwork until I get a consistent basic level of compliance with my requests, then he gets a scratch and put back into the turnout, and I just don't ride at that time. If that's the case, though, he gets a jolly firm workout, with plenty of trotting and cantering in the round pen, before it happens. I don't want him to get some idea that he can skive off work by tuning out on me.