Ship registration is similar to a person receiving a passport. It means that any ship can have a passport. In fact, when a ship is registered it means that a ship is documented and given the nationality of the country that the ship has been documented to. Therefore, this nationality allows a ship to travel internationally as it is proof of ownership of the vessel.
When a ship is documented, it means that the ship has the nationality of the country and can fly the flag of that country. This is called the law of the flag, and the country is often referred to as the flag state. This is important to have in mind that the U.N. Convention on the Law of the Sea (UNCLOS) and customary international law provide that, with a few notable exceptions, the flag state has exclusive jurisdiction over its vessels on the high seas. Stateless vessels upon the high seas do not enjoy the legal protection accorded to flagged ships under international law. As such, they are subject to the extraterritorial jurisdiction of any authority on the scene.
A ship's flag state exercises regulatory control over the vessel and is required to inspect it regularly, certify the ship's equipment and crew, and issue safety and pollution prevention documents. The organization which actually registers the ship is known as its registry. Registries may be governmental or private agencies, or in some cases, a third party is administered to do the inspections.
Sometimes, vessels find another way for registration, that is called "flags of convenience”. In this case, vessels register with states with which they have no real connection but the state is known to have low fees and few enforcement mechanisms, and it is easier for them to have their flags.
However, there are another kind of vessels: vessels without flags. I quote this part from [Bennett, Allyson. "That Sinking Feeling: Stateless Ships, Universal Jurisdiction, and the Drug Trafficking Vessel Interdiction Act." Yale J. Int'l L. 37 (2012): 433], who says:
In addition to ships flying flags of convenience, some ships have no nationality at all. Ships without nationality, also called stateless, flagless, or unregistered vessels, undermine the law-of-the-flag regime. Because stateless vessels do not have a flag state, no state can exercise control over them on the high seas or provide diplomatic protection on their behalf. Ships can become stateless in a variety of ways. They may lose their nationality if they violate their flag state’s laws or do not comply with its requirements; their flag state may be unrecognized by the international community; or they may never register with any state. Furthermore, ships that sail under more than one flag, using one or the other according to convenience, are “assimilated” to stateless ships under UNCLOS. Because stateless ships do not enjoy the protection of any state, some countries and scholars have asserted that any state can assert jurisdiction over them. But, as discussed infra, a ship’s statelessness alone may not authorize such actions.
When a vessel has no flag, it could mean that it is not registered and therefore there is no control over the vessel, the equipment of the crew might not be certified or there might be issues of safety or pollution. But still it does not mean that, in international waters, other ships could treat the vessel like a pirate, or anybody can seize the vessel for having no registration. Some scholars believe that the freedom of navigation in high seas (in customary international law) belongs to states and not individuals, which means unregistered vessels are not free to navigate since they are not under any state.
I would like to quote another part from [Brendel, Joseph R. "Marijuana on the High Seas Act and Jurisdiction over Stateless Vessels, The." Wm. & Mary L. Rev. 25 (1983): 313.] that mentions:
Commentators agree that stateless vessel status is undesirable in the scheme of international maritime law. The registration of ships is essential to the maintenance of order on the high seas. As a result, a stateless vessel “enjoys no protection whatever, for the freedom of navigation on the open sea is freedom for such vessels only as sail under the flag of a State”. Stateless status deprives a vessel of important privileges, such as the right to enter and leave territorial water and ports.
Meanwhile, it is necessary to know about the Right of Approach - which is a right of investigation of the flag. A warship may intercept a vessel, inspect it from a safe distance to determine its name, flag, and home port, receive and review any data the vessel might be emitting from its automatic identification system. Also, if there is no response, then there are the rights to visit and to board. Therefore, for a vessel without flag, there is still the risk of being approached by the military vessels or certain governmental vessels (Article 110 UNCLOS).