For me its all about consistency during a session. When I did train with others, I started the session off with distraction of socializing and whatnot. Because of that, it felt as though it was apart of the environment and it wasn't a distraction.
That said, I was able to shut off my mind within the second prior to a lift. Clear the mind and perform the lift before getting back to whatever it was.
On the otherhand when I'd start off training alone and someone or some distraction would come around half way through my session, I'd well... get distracted. That person or thing moving around or making noise was not apart of the environment before and is now sticking out like a sore thumb. My focus, as much as I try not, is diverted.
Same goes for music. If I begin a session without music, turning something on part way through a session becomes a HUGE distraction. But having it on from the beginning does nothing.
Either way, you gotta have a clear mind right before the lift and during it. Without that, it won't matter if your miles from a distraction or you have someone lighting fire crackers right next to your head.