We consider the querying service (e.g., location-based query service) in vehicular ad hoc networks (VANETs). Querying service has been studied in various kinds of networks such as traditional mobile phone networks and other mobile ad hoc networks. However, existing schemes are either not suitable for VANETs due to their highly dynamic environment or do not provide a privacy-preserving solution. In this paper, we first discuss the security concerns of providing a querying service that ensures that a query will not be linkable to the querier. Then, we briefly highlight the characteristics of VANETs, which make the problem different from other types of networks. Finally, we propose a solution for solving the problem by using techniques of pseudoidentity, indistinguishable credentials, and oblivious transfer. We show that, although all infrastructure units collude, it is still impossible to link the real identity of the user to a query. Based on our simulation study, we show that our scheme is effective in terms of processing delay, message overhead, and success rate.