~でよかったね=It's good that...
一緒にいなくてよかったね=you were not with...
主語が「私と」であれば、
It's good that you were not with me
主語が「彼と/彼女と」であれば、
It's good that you were not with him/her
主語が「彼らと」であれば、
It's good that you were not with them
あの時=at that time
是非参考にしてみてください。