You need to know the pressure and temperature if it is a gas. The density is the mass per volume, so you can use the Ideal Gas Law (see Related Questions to the left) to find the number of moles per volume (n/V) and then convert moles to grams.
If it is a solid (dry ice), the density is 1,600 kg/m³.