Not sure what steps you have taken......... but lets assume this is a new condition. IF her only reason is.... it is painful......... A DR should be consulted. There could be an underlying medical problem that is potentially harmful to her health, let alone her libido.
Lets assume now that her health is ok....... consult the dr to determine why it is painful. IF she is menopausal you might need to use a lubricant on a regular basis.
Lets assume now that lubrication is not the issue and she just does NOT want sex. You may want to ask what her feelings are toward the marriage in general.
I have 27 years invested, certainly don't want to start over now, and have nowhere to go any way. Does NOT sound like there is very much love left there. Are you a recent empty nester? Kids are a focus and mission. When they are gone, a couple is left with each other and really have no idea who they are at this point in life. Instead of courting someone new for sex.......... why not court each other and see if you can re-kindle the spark. An affair MIGHT be easier at first........ but IF she finds out and is NOT amused........ you just might find yourself "starting over with no place to go" anyway.
After all is said and done....... if she tells you to leave her alone and go find "it" somewhere else........ well, there ya go.