Robust entanglement preparation against noise by controlling spatial indistinguishability