If you want to retire in Thailand or wish to stay with your spouse (who might be a B visa holder) you will have to apply for an O visa. The O visa is valid for 1 year and does not allow you to take up employment.
To apply for an O visa you will have to submit the following:
Fully completed visa application form
Passport or travel document, valid for at least 18 months
One (4 x 6 cm) passport photo, taken within the past six months
Evidence of adequate finance
Birth certificate
Certificate of marriage (if applicable)
Medical certification
A copy of a bank statement showing a minimum of 800,000 Baht in your account