More exactly, nations will not regard places outside of their physical limits as outside of their jurisdictions.
Traditionally, a nation has regarded any ship flying its flag as under its jurisdiction, and a place where it may enforce its laws. More recently, many nations will undertake to enforce laws in cases where their citizens are the victims, or in some cases the perpetrators of crimes even within other nations, and more freely on the high seas outside the physical limits or territorial waters of any country.
Historically, all nations undertook to enforce laws against piracy wherever they might be committed.
Several countries, including the UK and the US, now treat the UN Law of the Sea convention as part of their national law, which defines as piracy: "illegal acts of violence or detention ... against persons or property on board such ship or aircraft" This would include the situation described in the question.
Therefore such actions could and quite likely would be prosecuted by any of several countries, depending on the registry of the vessel and the nationalities of those involved.
18 U.S. Code § 7 provides that:
The term “special maritime and territorial jurisdiction of the United States”, as used in this title, includes:
(1) The high seas, any other waters within the admiralty and maritime jurisdiction of the United States and out of the jurisdiction of any particular State, and any vessel belonging in whole or in part to the United States or any citizen thereof, or to any corporation created by or under the laws of the United States, or of any State, Territory, District, or possession thereof, when such vessel is within the admiralty and maritime jurisdiction of the United States and out of the jurisdiction of any particular State.
(7) Any place outside the jurisdiction of any nation with respect to an offense by or against a national of the United States.
(8) To the extent permitted by international law, any foreign vessel during a voyage having a scheduled departure from or arrival in the United States with respect to an offense committed by or against a national of the United States.
This US DOJ page says:
Among the offenses within the special maritime and territorial jurisdiction of the United States are the crimes of murder, manslaughter, maiming, kidnapping, rape, assault, and robbery. Pursuant to 18 U.S.C. § 7(1) there is also jurisdiction over such offenses when they are committed on the high seas or any other waters within the admiralty and maritime jurisdiction of the United States that is out of the jurisdiction of any particular state. See JM 9-20.000 et seq.
The page "Maritime Offenses" from the law offices of Trombley and Hanes says:
The Federal government also exercises jurisdiction over certain maritime offenses. There is Federal jurisdiction for offenses committed on American vessels in the territorial waters, harbors and inland waterways of foreign nations. See United States v. Flores, 289 U.S. 137 (1933).
A number of Title 18 sections specifically declare certain conduct to be a Federal crime if committed “within the special maritime and territorial jurisdiction of the United States.” See, e.g., murder, 18 U.S.C. § 1111. In some instances, the Assimilative Crimes Act, 18 U.S.C. § 13, is also applicable. See also, 15 U.S.C. § 1175; 15 U.S.C. § 1243; 16 U.S.C. § 3372.
18 U.S. Code § 1111 (b) provides that:
(b) Within the special maritime and territorial jurisdiction of the United States,
Whoever is guilty of murder in the first degree shall be punished by death or by imprisonment for life;
Whoever is guilty of murder in the second degree, shall be imprisoned for any term of years or for life.
The Britannica Article on "Piracy" says:
Because piracy has been regarded as an offense against the law of nations, the public vessels of any state have been permitted to seize a pirate ship, to bring it into port, to try the crew (regardless of their nationality or domicile), and, if they are found guilty, to punish them and to confiscate the ship.
The UN page on Piracy says:
The 1982 United Nations Convention on the Law of the Sea (UNCLOS) provides the framework for the repression of piracy under international law, in particular in its articles 100 to 107 and 110. The Security Council has repeatedly reaffirmed “that international law, as reflected in the United Nations Convention on the Law of the Sea of 10 December 1982 (‘The Convention’), sets out the legal framework applicable to combating piracy and armed robbery at sea, as well as other ocean activities” (Security Council resolution 1897 (2009), adopted on 30 November 2009). Article 100 of UNCLOS provides that “[a]ll States shall cooperate to the fullest possible extent in the repression of piracy on the high seas or in any other place outside the jurisdiction of any State.” The General Assembly has also repeatedly encouraged States to cooperate to address piracy and armed robbery at sea in its resolutions on oceans and the law of the sea. For example, in its resolution 64/71 of 4 December 2009, the General Assembly recognized “the crucial role of international cooperation at the global, regional, subregional and bilateral levels in combating, in accordance with international law, threats to maritime security, including piracy”.
The UK Piracy Act of 1837 defined as a crime:
Whosoever, with intent to commit or at the time of or immediately before or immediately after committing the crime of piracy in respect of any ship or vessel, shall assault, with intent to murder, any person being on board of or belonging to such ship or vessel, or shall stab, cut, or wound any such person, or unlawfully do any act by which the life of such person may be endangered, shall be guilty of felony...
The more modern UK law, the Merchant Shipping and Maritime Security Act of 1997 embodies the UN law of the Sea convention, including its article 101, which says:
Piracy consists of any of the following acts:
(a) any illegal acts of violence or detention, or any act of depredation, committed for private ends by the crew or the passengers of a private ship or a private aircraft, and directed—
(a) (i) on the high seas, against another ship or aircraft, or against persons or property on board such ship or aircraft;
(a) (ii) against a ship, aircraft, persons or property in a place outside the jurisdiction of any State;