To my knowledge there is no specific term for the example of people not being able to understand foreigners because they believe that foreigners cannot understand the language.
It seems to me to be the combination of several psychological biases.
The first that comes to mind is the expectation (or experimenter's) bias. It basically says that we experience what we expect to experience. Since we expect foreigners not to understand our language, we're closing off the possible experience of foreigners communicating in our language.
We thus develop a psychological blind spot.
The entire situation also requires that we make the (unconscious) decision to treat foreigners more alike than we would people we know. This is called a representativeness heuristic based on similarity.
If a foreigner speaks our language better than we expected, and we can't block it out, then we can make things harder for the foreigner by speaking faster, use more slang, etc. The foreigner will find it harder to cope, and thus fulfill our expectation. We thus create the "reasons" to deal with our cognitive dissonance.
Concerning pronunciation, it is established that there is a tendency of native speakers to infer more than they should from the less than perfect pronunciation of foreigners. Native speakers often conclude that the foreigners they talk to are less intelligent, less educated, and of a lesser social status than they really are, all the while forgetting that most of the times, the native speakers are mostly less capable of speaking the foreigners' language, than the foreigners are of speaking the native speakers' language.
However, this tendency seems to be countered to a great degree by how diverse a society is.