There's quite a few theories on anti-magic, and its interaction with spells like this. According to the notes, in most cases, a shell of anti-magic would grant the under immunity to such alarms, but also notes that some wards can be built to trigger if any part of it is broken; only managing to get the entire ward in an anti-magic field at once, or pointedly dispelling it, would prevent it from activating.