Not really, as it only works on the turn war is declared. If no war has been declared, they can still run through your space doing whatever they want. This is really only intended to prevent blitz-style attacks, where an entire civilization is destroyed in a turn or two due to prepositioned fleets.