I don't understand why in some cases, nouns have to add the word “le/la/l'” in front of them (e.g: in the structure “avoir l'intention de...” or “avoir l'air de”). However in some other cases, there is no “le/la/l'” going with nouns (e.g.: in the structure “avoir besoin de” or “avoir envie de”). Why?
I don't think you'll be able to find a satisfactory answer to this, because when it comes down to it, language isn't always logical. In fact, these expressions have English equivalents with the same article or lack thereof.
avoir besoin de = to have need of
avoir l'intention de = to have the intention to
avoir l'air de = to have the look of
Why do 2 and 3 have "the" but 1 doesn't? If you can find the answer to that, it's exactly the same for French.
The examples you give where there is no article are "Locutions verbales", i.e. frozen expressions that have the same value as a simple verb.
There are no rules to sort out locutions verbales. Some of them include an article, some don't, that's the way they are.
You simply have to know them, just like there is no logical way for a non English speaker to guess "to give up" even if he already knows both "to give" and "up".