You didn't do anything wrong--it sounds like you were reasonable to assume she was from X country and make conversation about it. Your boyfriend was very rude, in randomly accusing you of lying -- even if he meant it as a joke, the implication was that one of you (you or her) were lying, which is rude and pretty mean to both you and the woman of unknown origin.
The better way to handle it for all of you would have been to assume a misunderstanding and change the subject. I do think you were rude to speak about her in third person in front of her, but I also completely understand being caught off guard and I hope no one will judge you harshly for that. I'm sure I wouldn't have handled the situation any better. Sometimes, conversation is confusing and people misstep, and it happens -- compassion all around is what's required here, I think.