Subgroup separability and virtual retractions of groups