It has never happened.
All space missions have “abort” modes that allow them to come back to Earth ahead of schedule. The longest time to return was from the Moon, which took just under three days. If someone had died, they could have returned with the body. The same applied to the Space Shuttle, and still applies to the ISS. The crew always have enough vehicles to enable them to leave. From the ISS, it's only a few hours.
If someone were to die on a voyage to Mars, they would probably be “buried” in space.