The Giant Mole can not hit through prayer. It uses the melee prayer, so make sure you use that prayer in order to survive its accurate hits.  If you do not have the melee prayer, you also have the option to safe spot it while ranging. Just stand next to the cavern walls behind an obstacle.