David’s men believed, as Saul did, that if the circumstances seem right, the Lord is telling you through those circumstances what to do (see 1 Samuel 23:7).
David might have cut a piece of Saul’s robe without getting caught because Saul either took off the robe and set it aside or fell asleep in the cave.