Keep your friends close, and your enemies closer...
I never trust the AI, especially one that I share a border with. I am more apt to somewhat trust an AI rival separated from me by water or several other civs before I trust my neighbors. Not that I extend too much faith to any of the rivals, mind you.
If someone is about to sneak attack you, and you are not able to handle them, you have several options.
1. Let them pound you. Defend as best you can and sue for peace as often as you can.
2. Try to sign a MPP with another civ, preferably a stronger one. Then, when the fool attacks you, your ally will hit them. This may also convince the sneak attacker to back off before war is even declared.
3. Try to sign a MPP with the attacker, or make some other deal with them that involves luxuries, resources, and/or GPT. That way, when they attack you the following turn, their reputation is screwed. I do this option if I can. Very effective.

Sometimes with will stave them off, but usually they break the deal anyway.
4. A combination of the above. Sign the MPP with a different civ, make a deal with the soon to be attacker, and let them pound you. Their rep takes a hit, the other civ is attacking them, and soon they will leave you alone to deal with the stronger enemy.
Of course, there are other options, but these are just some ideas.
Be careful with #3, sometimes the AI considers you the deal breaker, for some stupid reason.