If Dr. Jones is a surgeon residing on Main Street, his habitat is Main Street and his niche is surgery. Of course, we could be more specific. An organism might have a habitat in the bottom muds of brackish ponds and its niche might be conversion of organic molecules with sulfonic functions to mercaptans. There is an important distinction between organisms that can manufacture all their complicated biochemicals from a few simple elements and carbon dioxide and those that require preformed compounds. An autotroph needs no other life forms to supply its needs, but a heterotroph must have biochemicals produced by living organisms although the immediate source may be dead or decaying matter.
Chemotrophic organisms derive their energy from chemical oxidations and reductions.
Comments about real microbial ecosystems. Troy, NY 2nd ed.