If you are using PCL, default value of invalid data is not NULL, but is NaN. So if you want to mark a point as invalid, you should first include <limits>
file and then set the positions to 'std::numeric_limits::quiet_NaN()'. It is usually done like this
const float bad_point = std::numeric_limits<float>::quiet_NaN();
if( is_invalid_point )
p.x = p.y = p.z = bad_point;
But anyway, configuring ICP can be a pain. You may have to do a lot more parameter tweaking depending on your data.