Your detachment sounds like it is your mind trying to prepare you for the worse. Especially since you already have children that live away from you. I think you are just scared that this will happen again. Has the ex even mentioned wanting to have custody of the baby? You may want to discuss it with him to see what his thoughts are....he may not even want to have custody of the baby. You compared it to thoughts you had when your son was in the NICU...They try to prepare you for the worst and it does sometimes make you feel detached...like you don't want to fall in love with that child for fear that he or she may not make it. I have had 2 children in the NICU...one sadly died at 2 weeks. The other (my daughter) is now a healthy little girl and will be 4 next month!! Anyway, maybe talking to your ex will help with the detached feelings. Talking to a counselor may help as well. Your ex does not need to even know that you are doing it or why you are doing it. Also, I am sure that the first time you hold that baby in your arms all those feelings of love will fill you and you will love this baby. Some people just don't really feel attached their baby until he or she is born....especially in an unplanned situation.
Keep in mind this is just my personal thoughts and interpretations. It may or may not be correct but I hope it helps.

I wish you the best of luck in copeing with this unplanned pregnancy.
Please keep us updated as we worry about the women that post here and never post back to let us know how they are doing and if things are going better.