Try cor(A,B, use = "pairwise.complete.obs") . This will ignore the NS in your observations.
To be statistically rigorous, you should also look at the # missing entries in your data and see if there is a random assumption.
Edit 1: look at ?cor to see other options for the use parameter.
source share