As far as I know you can't. There is no abandon city button. In some previous games I seem to recall that you could build settlers earlier and remove the city that way since it cost pops. But that isn't an option since you need to many pops to do that.
I'm not even sure the AI will buy your core cities. As noted you can do it (raze) with cities you conquer, they can be razed at any time later (unless city-states or capital); holy cities can be removed if you remove the holy city status.
I guess you could do super badly in a war and hope the AI demands the city, or that they conquer it or conquer and raze it. You can't starve the city beyond size one either as far as I know, there might be some weird situation where you can out in the snow or something but I doubt it and it would be more of a fringe case. You could possibly starve the city down in size by just not working any tiles etc, sell all the buildings you can etc to make it an easier target for them.
You could probably flip-flop the city in a war since it will lose pops every time it its taken. So you let them take it, you take it back unless they burn it, hope they take it again and so forth until they either burn it or it's so small and useless that they will.
I guess if you really want to get rid of it you can delete, probably I have not tried it, using the In-game Editor or some similar mod.