Ok its TEchnically illegal to hold anyone ones passport here in Qatar, how ever some employers of low paid workers still practice this illegal activity.
Regarding Westeners and any one in Qatar the Possession of the Passport should always be with the Passport holder.
Regarding Exit, if you are on Sponsored and now have an RP, your employer needs to apply an exit permit on your behalf in order for you to leave the country.