Every now and then when I play the piano, someone in the vicinity will recognize the tune and hum, whistle, or sing along. I don't mind that; I think it's nice that they like the song and want to join in.
However, even if they're doing so in key and on beat, I suddenly find myself distracted and begin making mistakes. I guess I'm getting my main feedback from the piano's sound and the secondary input throws me off. I think it has to do with where the melody in particular is coming from — I also find it hard to play accompaniment to my own singing unless the piano is also carrying the main line a little, even if it's in a different octave or only on the downbeats.
Is there any way to train myself to handle this? How do professionals do it in live venues? (That's not where I usually am, but I imagine the problem is that much greater there!)