No one is saying the person of ethnicity is obliged to answer! But is the question racist? I've asked collegues with a North American accent where they come from, not quite knowing whether it's US or Canada. In fact, Americans love to talk about their ancestry, often European.
So does it make a difference if the person asked is a person of ethnicity? I don't know.
One of my elderly mother's carers was black, and I asked her what her accent was. She told me Zimbabwean. I didn't get the impression that she particularly wanted to discuss it however.