If I have the negative terminal of a charged capacitor, say 3V, connected to the positive terminal of an ideal battery of 5V, leaving the positive terminal of the capacitor and the negative terminal of the battery not connected, will the negative charge on the capacitor go to the ideal battery through the wire between them? If not, could please tell me why? Thank you!
No, there is no circuit being completed, hence no means for the "charge" to flow into the battery.
It appears that you expect a Coulomb static charge behavior to occur, such as in a Van De Graaf generator. That's static electricity, which albeit analogous to battery type "Direct Current" electronics, is not quite the same thing.
For one thing, batteries are not Coulombic charge storage devices: They are, at the simplest, reversible chemical reaction storage of energy resulting from ion flow caused by a potential difference. "No actual electrons are harmed in the battery process".
Also, though capacitors are technically charge storage devices, they would require a discharge path towards a lower absolute static charge potential point, for what you have asked, to occur. That's not the case here.