Development and Application of Optical Nanosensors to Study Chemical Microenvironments