The difference between a habitat and a niche is that a niche is:
The specific functional role of an organism.
Habitat is the dwelling place of an organism. It is a spatial term. An ecological niche, however, is not merely a spatial term, when an organism occupies a habitat it has certain behavioural adaptations that enable it to fit well into that habitat. The organism then interacts with the environment and takes on an ecological role that modifies and alters its habitat. Therefore an ecological niche can be defined as the role of an organism in its habitat.