I believe what you describe is called Lampshade hanging where you handwave an elephant in the room, and I use it all the time. Granted, it's IMHO vital for my style of comedia.
Not necessarily. There's a difference between lampshade hanging and pointing out that a character is a jackass. In the case of lampshade hanging, a character points out that something doesn't make sense because it's a plot hole, that a trope is being used, that something is cliché, and so forth. It functions primarily to remind the readers that, yes, they're looking at something fictional.
Meanwhile, pointing out someone's
hypocrisy is calling someone out on an action or opinion they've voiced that contradicts something else they've done or said. It functions primarily as a mark of realism. As in, pointing out hypocrisy is an
internal thing -- something that happens between characters without reaching meta levels. Lampshade hanging, meanwhile, steps outside of the boundaries of the narrative in order to point out that the conversation is occurring in a work of fiction.
That being said, what matt is describing is not really an element of comedy. Not necessarily, anyway. For example, let's say you're writing about N. N spends a good portion of the time in your fic preaching about how Pokémon need to be treated with respect, about how they need to be freed, about how humans need to take into consideration their rights, and so on and so forth. Then, out of nowhere, he battles another character, placing innocent Pokémon (in his view) in danger. He doesn't show a sign of being remorseful about putting Pokémon through a battle, and he orders his team around without giving them the opportunity to choose which attacks they use or what they do during the match. Maybe he even carries them around in Poké Balls as well. Considering he was preaching against being a trainer earlier in the fic, the battle would mark him down as a hypocrite because he'd be showing that he has no qualms about training, yet he preaches that catching Pokémon and having them battle each other is wrong. In this case, there's nothing funny about it, and if a trainer calls him out on it, it's not breaking outside of the frame of the story. It's just saying, "Yo, dude. It's not cool that you're harping on me about what I do, only to do it yourself." In other words, that's not lampshade hanging. That's just calling him out. (If you really want to associate it with a trope, there's a whole
platter of them, and which one applies really depends on the opinion being voiced/acted upon as well as the character themselves. Note that it's only hypocritical humor that's always meant to be funny because of the whole definition of the term.)
To answer matt's question, yes, it's actually completely okay to have a character who's a hypocrite... if you know how to handle them. As Dragonfree said, if a character is being a hypocrite and if it's clear that the author doesn't see a problem with the way that character is acting or with what they're saying, then it rubs readers the wrong way. (I can't claim to know every reason because it really depends on the context, but you see it happen a lot with fics that lack solid characterization. If the author doesn't see that a character is being hypocritical, it's probably because they're forcing an opinion on the character without taking into consideration the rest of their personality. For example, if you have someone write N to have those anti-training opinions but no qualms about Pokémon battling and if that writer doesn't see any problem with having him do that, then that shows a reader that they're attempting to force N to be the stereotypical rival or trainer without taking into consideration what he's actually saying otherwise.) If the character's hypocrisy is clearly made to be a bad thing (either because they get called out by other characters or because it's discussed otherwise in the narration/events of the story), then it's actually not that bad of a theme to explore. Sure, focusing on the actual quality of being hypocritical (like making N over-the-top evil as you discuss exactly how he's being a hypocrite) may put you at risk of beating the reader over the head with your point, but having it brought up that a character is a hypocrite and that this is not necessarily okay shows that you're very much aware of what your characters are doing. They're not just sock puppets or vehicles for your own wish fulfillment fantasies, in other words. They have opinions, and there are consequences to what they do and say according to them.
So, yeah. Nothing wrong with having a character who's a hypocrite. So long as you acknowledge that there's an issue with that hypocrisy (and don't do so with all the subtlety of a sledgehammer to the head).