In A, "which museum" is a noun phrase and is the direct object of "visit". Within this noun phrase "which museum", "which" is the determiner and "museum" is the noun.
B is the same, except that "museum" has been omitted since it is, presumably, known from the context. That is, in B, "which" is a noun phrase and is the direct object of "visit".
It is ordinary for the noun of a noun phrase to be elided, leaving behind a determiner, when the noun can be figured out from context. "I visited two museums/I visited two." "I visited some museums/I visited some." "That lollipop costs too much/That costs too much." There is no need to make up some special name for the determiner of a noun phrase whose noun has been dropped because it can be figured out from context.