I always put on my headphones when I'm surrounded by people and about to do something that requires my absolute concentration.
It serves the following 2 purposes:
- Blocks me out from outside noises and distractions
- Sends a signal to the people around me that I should not be disturbed
You can try this out even if you don't like listening to music for long hours.
Many people just put on the headphones without actually playing any music to show that they're on a do not disturb mode.
So, it doesn't matter whether you play music or not, put on your headphones and keep away from distractions.