… research by Thames Water has shown that HIV can survive for several days in sewage in the laboratory.
HIV does not survive as long as other viruses in ocean/sea water.
Infectious HIV has been recovered from human corpses between eleven and 16 days after death in bodies stored at the usual mortuary temperature of 2°C. It is unclear how long infectious HIV may persist in corpses left to decay at normal room temperature, but HIV has been cultured from organs stored at 20°C up to 14 days after death. HIV was not detected in significant quantities later than 16 days, implying that buried corpses or those preserved for long periods pose less of a risk to undertakers and pathologists.
So in practical terms, there isn’t a simple, straightforward answer to the question of how long HIV survives outside the body. But there’s little reason to worry about contact with body fluids that have already been outside a person’s body for some minutes.
In certain, specific circumstances it may survive more than a few minutes. But it generally does not remain infectious and certainly does not pose a threat to people’s health.