It is true that "English native speakers use the definite article in front of a noun when they believe the hearer/reader knows exactly what they are referring to". For example: I went to a party last night. The party was boring, but I enjoyed the fireworks.
In this case the definite article in the second sentence is being used to refer back to the party introduced in the first sentence. This type of reference is called anaphoric.
But the definite article can also be used as a forward-looking (or cataphoric) reference. And this is how it is being used in the Harry Potter text.
This passage from Discourse Analysis For Language Teachers (p42) has the following explanation:
Forward-looking or cataphoric reference often involves pronouns but it
can involve other reference items too, such as the definite article.
The author cites two examples from Newsweek:
... which underline the most characteristic function of cataphoric
reference: to engage and hold the reader's attention with a 'read on
and find out' message. In news stories and literature, examples of
cataphoric reference are often found in the opening sentences of the
text.
The definite article in "the narrow, moonlit lane" has a similar function, namely to entice us to read on and discover the exact setting of this particular lane. Contrast Rowling's sentence with one using articles according to the 'rules' of the web site you refer to:
Two men appeared out of nowhere, a few yards apart in a narrow,
moonlit lane.
It is clear how very much better Rowling's version is.
In the first example, Doctor is being used as the name of the person; the doctor is more of a descriptive phrase. It's short for Doctor <his name>.
tend bar is a set phrase, it's a synonym for being a bartender. It's also similar to the way other people describe their work: a mailman could say I deliver mail, a programmer would say I write code, a garbageman would say I collect garbage, and a composer would say I write music. These are all using the noun to refer to the general concept, rather than any specific item, so no article is needed. You would add an article when you need to be specific, e.g. I write the music in TV commercials.
Best Answer
They're pretty much equivalent.
That said, omitting the article has a slight feeling of playing with a group or orchestra, wherein the instrument is a synecdoche referring to the position the person occupied within the group.
Omitting the article also can carry the feeling of playing an instrument in the general sense.
In this case it would sound strange to use the article because you are speaking of a class of instruments.