"Answer as per my knowledge"

Point No one: no one withheld your personal documents, companies used to keep passport and gave u ID until the end of contract but that policy has been modify you can keep ur passport and have ur ID as well.
If the organization that lend u the money open a court case u are entitle to stay in country until ur loan is paid in full and the case is closed.

Point No two: yes 100's of individuals used to leave the country leaving behind all kind of loans but Qatar is more aware of this kind of delinquency nowadays and options are getting less(even leaving the country its restricted by some companies using "EXIT PERMITS TO PROTECT THEMSELVE" and in several cases they check ur current legal status before they can approve one exit permit for you).

Point No three:
What would be the consequence of leaving a vehicle and an unpaid bank loan behind?

"INTERPOL" they will fallow up on ur case "using ur home country as intermediary" until they got their money back.

Point No four:
Would the individual be able to leave the car (and account?) in the hands of a friend to ensure that the bank loan was being paid until the car was sold?

"YES, ITS THE WISEST THING TO DO SO FAR"

Point No five:
And how then would the papers be transferred from the absent 'owner' to the next person who bought the car.

"Authorize a car agency, a friend or sign a power of attorney to the bank who gave you car loan in "recovering department"

Would it be a good idea to buy a car from someone in these circumstances?

"NO unless, this person hand over the car to the bank and you get it thru the bank.

Please notes this is just as per my knowledge I would strongly recommend you to:
1- consult a lawyer (no need to be expensive one)
2- Call your Bank recovering department they usually have many good options as they would like to help you solve this issue in a shop period of time and in the best way possible for both parties.