We study the effects of optical and atomic decoherence in entangled atomic ensembles produced via quantum nondemolition (QND) measurements. We examine potentially experimentally detrimental effects, such as optical phase diffusion, photon loss and gain, and atomic dephasing. For the optical decoherence channels, we use the technique of integration within ordered operators to obtain the associated Kraus operators. We analyze the effect of different decoherence channels on various quantities, such as the variances of the spin operators, entanglement and correlation criteria, logarithmic negativity, and the Bell–CHSH inequality. We generally find a smooth decay of correlations and entanglement in the presence of decoherence. In the short interaction time range, we find that various quantities show signals consistent with, and showing that entanglement exists under all three types of decoherence. Our results show that QND measurements are one of the most promising methods for entanglement generation between two Bose–Einstein condensates.