Mach 1 is slower at higher altitudes (At FL350, 290knts is about 0.82M and at around FL270, 290knts is somthing like 0.72M).
The figures may not be accurate but while knots is a constant speed no matter what hight you are, the speed of sound is slower the higher up you go.
(somthing to do with air density alowing vibrations to travel through the molecules quicker).
the denser the material the quicker the sound travels. However the density of the air doesn't affect the speed of sound as much as you describe.
Airspeed (and altitude) is determined by the pitot static system, it measures the air passing by the aircraft (I think, someone else will be able to describe it bettter)
Because the air is less dense, then as your ground speed stays the same (the speed you are relative to the ground), however your Indicated airspeed(IAS) changes - goes down as you go higher (this is what happens when you select mach speed as your autopilot mode and you change altitude.) (mach speed is about the same as ground speed)
conversely when you select IAS mode, and your IAS stays the same (say 270kts) then when you change altitude your ground speed changes, it gets slower as you go down.
Someone else will probably be able to give a much better explanation than I can.