In some countries, if a foreigner goes to live there, even if for several decades, they are always treated in part as an "outsider", regardless of their actions and attempts to integrate into the society, or citizenship status. There may be many aspects of the culture they are not allowed part of. They might not be allowed to take part in certain sacred rituals. They might be treated be not allowed to marry simply because of their being from another culture. They may make friends, but the friends might still regard them differently from "local" friends.
I hesitate to use the words "racism" or "xenophobia" to define this, because often these are just old rules in society, and fear or hatred are not a component, at least in modern times. For instance, I live on tribal lands. Though I feel quite welcome in the day-to-day situations, I am excluded from certain activities simply because I am not a member of the tribe. I cannot, for instance, go to certain sacred areas or attend certain secret ancient rituals. I also would be treated badly if I fashioned my hair in the tribal way, dressed in their traditional or even modern fashion style, or mimicked the tribe's unique accent. Yet, the reason is some ancient taboos that nobody today understands...no hatred or fear is involved...that has just been the rules since the beginning of time, so it seems unfair to people experiencing real racism to also call this racism.
So, what is a good term for this different treatment of people because they are a foreigner?