Indeed "une discothèque" can be either a "nightclub" or "a music library"
I'd like to know this too. Even if you say "to the nightclub" it doesn't necessarily refer to a specific one, but just the idea of a night club. Just like saying "do you want to go to the pub?" is a generic saying in English and can mean any pub in town.
No one will ever say "do you want to go to one night club?" as Duo suggested.