The variety of living organisms that exist in an ecosystem, which can be greatly affected by habitat loss.