Those that are not within earshot
Seriously though, I think it depends on the type of humor and the topic. I think it has to do with how homogenized the stereotypes are, to the point that people are aware that it's a stereotype and not the standard case. In bitter engineer's examples, the stupid Polack stereotype is so obviously false to the point that it's harmless, or at least, not offensive to most people.
In the USA, there are a few "untouchable" groups, mostly because there really aren't any non-offensive stereotypes for them. Taking the Simpsons as an example, I haven't seen any stereotypes for African-Americans beyond Dr. Hibbert's hairstyles through the times (I can only recall braids). In fact, Dr. Hibbert is pretty much the antithesis of black stereotypes, having graduated from Johns Hopkins University and becoming a successful family doctor. This is possibly a case of trying too hard to avoid any stereotypes. Latinos also aren't made fun of that much, aside from Pedro (the guy in the bumblebee costume). However, the Scottish, Asian Indians, Chinese, Japanese, Rednecks, Left Handers, and Christians are okay.
If anything, it also seems groups who have an upwardly mobile majority are suitable targets.
In response to masterbrownshoe's assertion that it's more acceptable in the USA, I can't give an accurate response since I've never lived a significant amount of time abroad.