The O2 sensor is actually closer to the muffler, actually just in front of it between the body and the chassis.
It is an electrical unit, so you cannot tell by looking. Considering its general location, it will be fairly dirty anyway. There are electrical resistance tests that can be performed to determine whether it's good or bad, but one of the techs in this forum would have to give you the details on that.
The "quick and dirty" way (my favorite) is to disconnect it and test drive it to see what kind of behavior your car is exhibiting. It's a not a cheap item, nor is it expensive, so I wouldn't just change it out for grins. If the quick and dirty way gets improved performance, then I would further inverstigate with the electrical tests to be absolutely sure.
2009 ML350 (84K) - Family vehicle
2001 CLK430 Cabriolet (71K) - Wife's car
2005 BMW 645CI (124K) - My daily driver
2012 Mustang V6 (60K) - Daughter's car