  We derive the equation of state of a two-dimensional Bose gas in an optical
lattice in the framework of the Bose-Hubbard model. We focus on the vicinity of
the multicritical points where the quantum phase transition between the Mott
insulator and the superfluid phase occurs at fixed density and belongs to the
three-dimensional XY model universality class. Using a nonperturbative
renormalization-group approach, we compute the pressure $P(\mu,T)$ as a
function of chemical potential and temperature. Our results compare favorably
with a calculation based on the quantum O(2) model -- we find the same
universal scaling function -- and allow us to determine the region of the phase
diagram in the vicinity of a quantum multicritical point where the equation of
state is universal. We also discuss the possible experimental observation of
quantum XY criticality in a ultracold gas in an optical lattice.
