A Comparative Study of Density Field Estimation for Galaxies: New Insights into the Evolution of Galaxies with Environment in COSMOS out to z ~ 3