Xcode will work on that system, but performance will be bad with only 2GB of RAM, especially with some of the debugging tools, or if your app is only half finished and you haven't optimised it's memory usage yet (I like to get my app working first, and then figure out how to reduce memory usage later).
It will be absolutely worth spending a tiny bit of money to upgrade it to 4GB, and honestly I would upgrade to 8GB instead.
RAM is usually cheaper if you buy from a third party and install yourself. There are many RAM companies who will tell you exactly what RAM to buy for your specific mac and how to install it (sometimes installation is easy, sometimes it's difficult, depending on the model).
Even if money isn't much of an issue (boss paying for it, etc), I still prefer to install it myself because build-to-order configurations can add weeks to the delivery time, when it only takes 10 minutes to install the RAM yourself (and you can use it with only 2GB if the mac arrives before the third party RAM). The only drawback is if you break something installing the RAM, it won't be covered under apple's warranty, and you may need to install the old RAM before doing a warranty claim, to prove that your third party RAM isn't the problem (bad RAM can cause all kinds of crazy issues).
The CPU and Graphics card are both plenty fast enough, as long as you're not working on 3D games.
Note there are plenty of mac programmers who always buy the most expensive Mac Pro available and still wish it was faster. If you buy a budget mac, don't expect Xcode to be blazing fast! But it will be plenty fast enough to get work done even on old second hand hardware.