An Air Marshal is a very important job to the Security of the Airline Industry. Being Highly trained in how to Dispose of bombs or defuse bombs.... and good firearm skills. The FBI (USA) CIA (USA & UK) Or MI5 (UK) Train these individuals to the core.
Yes, Advanced Federal Law Personnel are allowed to be equipped with a Fire Arm En board an Aircraft, usually being a very powerful pistol. Nothing Larger, because Piercing an Aircraft's "Skin" with a bullet, is enough for the pressure to be released, de-pressurising the cabin, making a huge gaping hole in the Aircraft and send the aircraft falling towards the ground, until the Air is pressurised again,(Around 10,000 Feet)
Before Boarding, the Air marshal would be Identified to Crew and other Air Marshals On Board. (there might be a few sometimes!) Air Marshals also know Aircraft's inside and out.... knowing how to get places only the Pilots would know. And are also there to aid in the event of a seriously ill passenger, to de-boarding the aircraft in the event of an Emergency And Instructing Passengers and Crew in the event of an Emergency. They are also their to Aid the Pilots, and are allowed to into the Flight Deck when ever they want, although this happens very very rarely, as it would give away who the Air Marshal is. The are also equipped with Passenger Manifests and other Electronic Devices that are in Direct contact with the Authorities on the Ground. They also have a Device that can alert the Authorities on the ground by the push of a button and enter of passcode.... this alerts the ground authorities that something is very wrong with the aircraft... and alerts the Air Force, Which would dispatch Fighter jets to the Air crafts position. There is alot more to the job than what you think.
An Air Marshal has to be assigned to a Flight, and there is never a flight without an Air Marshal, so your question about no Air Marshal is defunct.