I think I can confidently suggest you have probably experienced so-called "selective hearing" from your dog, but how you interpret what underpins your pets occasional "brain fogs" probably serves to either strengthen or undermine your dog training efforts. There are a lot of opinions regarding dogs and their compliance--or lack thereof--and an amazing array of methods intended to inspire canine performance motivation.
Could this dog--your dog, the one who responds like a slavering Pavlov-subject, ready to leap through flaming hoops, or at least sit at the speed of light in response to the slightest rattle of the dog cookie jar--be the same beast who stands in the backyard with snout in the wind, flipping you the hypothetical bird? Might this dog have an inkling how humiliating it is for you to prance around in your PJs shouting "Treat! Treat!" for the entertainment of the neighbors? Sorry, but no matter how ticked off it makes you, your dog lacks the ability to theorize what you are thinking and feeling. Instead he experiences how you respond to your thoughts and feelings, for better or for worse. Additionally, dogs lack human moral coding; they are not evaluating life nor considering their own performance from your empowered (you hope) human perspective. Dogs do things for dog reasons, as they should.
So, is that selective-hearing moment a by-product of improper education, indifference, defiance, or distraction? I would argue for improper education, indifference and distraction, but defiance is wishful thinking. No offense, but your dog doesnt come with a built in will to serve. To defy you, first your dog would have to feel a duty to comply, and then challenge it. Dogs certainly will cooperate, provided they find compelling reasons to do so, but they are not selfless creatures just hoping for a chance to fetch your slippers. A dogs work ethic is cultivated. Methods may include the use positive reinforcement such as applied rewards, access to lifes rewards through your facilitation, and gains of social connection and security. Sadly, motivations may also include punishment; though there are better ways, some trainers still seek to illicit compliance from dogs who learn to avoid harm, threat, or rejection.
A dogs occasional "selective hearing" moments frequently stem from owner handling errors. Do you multi-cue like a broken record (sit-sit-sit-sit, etc.?) This could contribute to a reduced consistency in follow through from your dog, who has been taught--by you!--to tune you out. Do you bribe, rather than strategically (and correctly!) reinforcing compliance? This is another owner error that may undermine reliable responses from otherwise occupied pets. When there is nothing better to do they may work you over like a vending machine, but when presented with higher value, self-serve reinforcements of the positive variety--such as the offerings of the great outdoors--you may be left standing in bad pajamas with a cookie jar in your hand. Do you get angry at your dog? Your emotional ups and downs add stress and create mixed messages which may lead to hesitancy and avoidance from your dog. Are you a dog "dominator," extorting submission from your canine "friend?" This same dog may begin to reflect your overpowering ways back at you, asserting the power of ignoring and avoidance when out of your hands-on reach.
Properly trained dogs still occasionally test their handlers, despite solid, unwavering use of positive reinforcement; and even the best handlers make mistakes that inadvertently inspire their dogs to occasionally "test" them. Getting a dog to respond reliably and consistently requires a broad and creative understanding and application of positive reinforcement. It also requires awareness a dog learns systematically, through his own process, and part of the process is...selective hearing! From my viewpoint, a dog who examines his options--including ignoring me--is a smart dog. Luckily I am a smarter trainer, and in no time I will have that dog craning to hear what I might have to say, ready and willing to cooperate. Not sure how to achieve this with your own dog?? Take my class!