You should break the window which is furthest away from the child in order not to injure them with glass. Although car window glass is designed to shatter into little circles/hexagons so it should not be sharp. Then reach in to unlock the car using the door locks which should open the back door and let you get to the child seat. If you can already see signs of heat distress (newborns do not usually sweat that much) then you do this immediately. The law is on your side.
Possibly the guard was ignorant of the law or there had been some previous incident where someone had got into trouble, but still.
Steff, you should read the Fatal Distraction article before judging. I believe it happens more often in the US due to a combination of factors - different workplace car park set ups, short parental leave, high pressure on parents, as well as a different climate. It's not typically so hot in the UK that a child left in a car would be in mortal danger, even during summer (though, obviously, still not great to leave them).
Perhaps there are a minority of parents who are neglectful or malicious - but I believe most car deaths are utterly tragic accidents.