Scratching stimulates the other sensory nerve endings as well as those already giving off itch so the itch message gets swamped in all the other signals by the time the signals reach the spinal cord. (This is the simple explanation - there is a more complicated one but that involves types of sensory receptor and which kind of sensory nerve fibre each uses, but it all boils down that)