Yep, that's the part I hate, too. The locals put up completely understandable roadblocks to preserve their own culture, but those roadblocks end up making the whole situation hostile and unpleasant for anyone who is not known to the locals.
Since you've never been, let me just say this: most tourists are utterly clueless, so just not being clueless goes far. Blend in, imitate the locals' behaviors, try to speak the language, eat what you're given, etc., and you'll be fine. For now, at least, relatively few places ban foreigners outright.