Although you are de-facto right, limitations on the dictatorial power do apply. Both by the international law that guarantees the "freedom" and regulations set by the flag it waves.
These exceptions and limitations do not exist in outerspace, thus only the spaceship captain is totally free/unregulated.
I might be remembering wrong, but I thought un-flagged ships in international waters are considered pirates and can be acted upon in a hostile manner by flagged ships.
Theoretically possible because an un-flagged ship has not the protection of a recognized state. You could do it, but it would be mighty risky and you would have almost zero legal recourse against a bad actor.