generally I try to avoid doing it, but it doesn't really hurt anything if the box is solid and doesn't resonate much. it looks a bit ghetto, and if the box does resonate it can wear on the amp some. It also makes things a lot easier to steal. you want both the box and amp securely bolted to the car, ideally. prevents shifting around in an accident of under hard braking or acceleration and cornering, and it deters theft.
Generally it's NOT a good idea. Unless you're talking about 100w rms or lower, the constant pounding will eventually wear down the components inside the amp. Besides, that's what separates you from the "ghetto" setup.