Protecting a nuclear spin from a noisy electron spin in diamond