Headphones work in two ways: as a signal to others that you don't want to be disturbed and the audio signal should drown out environmental noise and prevent you from becoming distracted.
And practicing meditation can't hurt, it'll help with focusing.