Grab hold of the bolt head with your fingers or with pliers and remove the nut if you can. If the nut is stuck, try dowsing it with spray lubricant.
Remove the bolt and place a lock washer or a rubber washer around the shaft so it fits snugly around the bolt neck against the bolt head.
Reinsert the bolt into the hole and add a regular washer to the other side if there is not one already. Screw on then tighten the nut. A lock washer should grab hold of the bolt head and keep it from spinning. A rubber washer should provide traction to keep the bolt from spinning.
Apply epoxy beneath the bolt head if the lock or rubber washer isn't working or the nut could not be removed in the first place. If there is not enough of a gap under the bolt head to inject glue with the standard epoxy applicator, use an adhesive syringe. Allow the epoxy to cure according to the time indicated in the manufacturer's instructions before tightening the nut.