I'm using a PhD student as a reference for an application, and I wonder what title I should use for her. She hasn't yet got her PhD title but is still writing her thesis. Is there a name for that position?
The title would likely be "Mr." / "Mrs." / "Ms.". There is no prepended academic title that means "will likely have a doctorate at some point".
In other news, a PhD student is probably not a good reference in the first place. You should look for somebody who has been in the game a bit longer and provide a reference that more plausibly compares you against a wider range of previous students.
I would use Mary Smith, Ph.D. Candidate
In my social sciences field (in the USA), Ph.D. Candidate is the accepted title once you defend your dissertation prospectus. Since the process is formal and sometimes arduous, we are very careful not to refer to a Ph.D. Candidate as a Ph.D. Student. Everyone distinguished between these two ranks in their email signatures and websites.
Also, the OP doesn't note the type of position that this person is being used as a reference for. IF it is an academic application, I would recommend a more senior reference. If you need a character or skills reference for some sort of non-academic position (where references are only checked as a formality by the HR department), this is less of a problem.
Another alternative that sounds slightly more formal and hasn't been mentioned yet is doctoral student.
You can put "ABD" after her name. From Wikipedia:
"All but dissertation" (ABD) is a mostly unofficial term identifying a stage in the process of obtaining a research doctorate in the United States and Canada.
You could also say
Marie Smith, PhD candidate.