Vanishing of relative homology and depth of tensor products