Nothing will be fool proof. I tell you this because I can buy a phone today, and a month from now the original owner can report it stolen. Hell, they can do this just because, no real reason, just to be a d*&K (you can look at step 3 to *maybe* nagate or reduce that risk some).
That said, I have been buying phones (including an iPhone 5S about two months ago) for a while and have some guidelines.
1. I ask for the box with matching IMEI. No box, no sale. No exceptions. I also like to ask for a receipt and am generally more willing to pay a little more for phones like this.
2. I play with the phone, make sure all is working, and have them restore the phone in front of me. From there I set up my own login
3. I meet at the [your carrier] store. I ask the reps to update the system and make notes that persons who have the rights to make account alterations made the trade on premises. They will get info from both parties to verify your identity. This all MAY not help, but it's an extra layer of security.
4. If Apple Care + is being transferred I like to meet at Apple as well (maybe first). I realize this step isn't feasible for everyone; when we lived in IA the closest Apple store was 45 minutes away for me.
Obviously the only purely safe bet is buying straight from Apple or your carrier. It's one of the reasons BRAND NEW phones are $100 (or more) cheaper than retail. My last bit of advice is that if getting scammed is going to financially ruin you, it's not worth it. If you have to go without a phone for months because someone screwed you, DON'T DO IT. If getting burned amounts to nothing more than a slap in the face, go for it. Scammers/theives are usually not going to be sophisticated enough to pass all three (or four with AC+) checks. The biggest risk you run is just that d-bag guy deciding he is going to report his phone stolen because he can.