We describe a recent experiment performed with rubidium atoms ($^{87}$Rb), aiming at studying the coherence properties of a two-dimensional gas of bosonic particles at low temperature. We have observed in particular a Berezinskii--Kosterlitz--Thouless (BKT) type crossover in the system, using a matter wave heterodyning technique. At low temperatures, the gas is quasi-coherent on the length scale set by the system size. As the temperature is increased, the loss of long-range coherence coincides with the onset of the proliferation of free vortices, in agreement with the microscopic BKT theory.