There seem to be two issues in the question and the answers, one is if it is ok with headphones on and the other to play music in the office during hours when student contact is expected.
Headphones. Wearing headphones is not exactly inviting to conversation but signalling "I want to be undisturbed" so clearly not the best way to have students approach you during office hours without invoking some extra discomfort to at least some.
Music. Music is a personal taste. What is soothing to one person may be almost intolerable to another. During a meeting one expects full attention from, in this case, both parties. Thus having music on does not signal that focus is on the potential visitor but that it is divided and hence that the visitor is of less importance and maybe intruding. Turning it down when a visitor arrives, anything less would be rude but why insist on music when expecting visits? At other times, no problem.
A professor-student meeting is not less professional than, say meeting your bank representative or meeting with public officials. How would you feel if you were met under similar circumstances in business of public servants? that is the sort of question one would need to ask and sometimes even what other would think.
So, acceptable? Well, it depends on what signals one wants to send. It will be up to each person to figure out the optimal meeting atmosphere. As for the case portrayed in the question, I vote for far less than optimal.