You can define g' such that the potential energy is mg'h, but this would be an odd definition as the density of the object would contribute to g'. I would change m to m' which is the difference of the mass of the object and the corresponding mass of water. If you just know the density, but not the total mass or volume of the object, all you can calculate is an energy density: ##\frac{E}{V}=\rho'gh = (\rho_{object}\rho_{water})gh## where ρ are density values.
