Yes it is, but the game first checks your target, declares war (I think), and THEN checks whether you actually can go there.

So you can not invade a province of an ally when his ship is there, because he stops being your ally before the shipping is done ...