I got a new 35mm f/1.8 lens for my D40 and I am shooting all the pictures with the lens hood. Should I leave it on the lens all the time or are there some situations where I would need to take it off?
Unless the lens hood is in the way (for example if you are using a polarising filer that you need to access, or when putting the camera in a camera bag), there is no reason to remove it.
On the contrary, it does offer some protection for the front lens element, so leave it on as long as you can. Unlike for example an UV filter, it doesn't introduce any more glass in the light path, so there isn't even the smallest negative effect on the image quality. Any optical effect at all (reducing lens flare) is only positive.
If it is not interfering with your on-camera flash, no, you don't need to remove it at all. I'm not sure about this hood, but you can usually put them in reverse position when packing the camera to make it smaller.
Hoods are actually more useful than UV filters to protect the lens because they don't reduce the image quality. so use it if you can :)