Where can I do a research paper or thesis without enrolling in a college or university?
It's not impossible, but in this day and age it is extremely rare for individuals unaffiliated with research institutions (academic or commercial) to successfully publish scientific research papers on their own (without research-institute affiliated co-authors) in good journals (bogus journals publish almost anything for a fee).

The main reasons are that in order to pursue cutting edge research, one usually needs


access to all relevant publications;
regular exchange of ideas with other researchers;
access to hardware (for performing the research tasks).
a living and financial support for the research (including possible publication charges)


Points 1&amp;2 are more fundamental, since if you don't know where the cutting edge of research in a particular field is (or don't know the relevant terminology), then you cannot contribute. 

I should also note that there are quite a few unsuccessful manuscript submission from unaffiliated persons, but many are often not even considered for peer review by the journal editors for two possible reasons: (1) because the manuscript does not appear to meet the standards and (2) because the editor strongly suspect it doesn't, because of the author's affiliation. So there is another potential hurdle: editorial bias.