We cannot prevent it, we can only detect it and (try to) identify who did it. The planet (some special interest areas) are constantly being monitored (satellites, surveillance drones) and when large ships are not being 'naughty' (switch of transponders) it's relatively easy to put two and two together.
As a side-note, Russia's playbook it to cause small and frequent sabotage(s). Small enough to not cause massive retaliation (i.e. it forces someone to destroy their railroad infra by causing thousands of derailments within one hour), and frequent enough to cause actual damage.