Developer cannot charge you for basement car parking or an open car park

A developer cannot charge you for a stilt car park [basement car parking] or an open car parking space.

Legally he is not allowed to sell car park then how can he do so

Yes, as per law, they cannot. But, they take advantage of the fact the nobody is ready to challenge it in the court.