Welcome to LQ.
It's been a while since I used an .rpm based distro, but I'll try to answer your question.
If I remember correctly, rpm uses /etc/rpmrc (or an rpmrc somewhere in /etc) which directs rpm to reference a database of installed rpms. The database is in /var/lib/rpm. I don't remember where the rpms themselves are stored.
When I executed rpm build command , it created a directory rpmbuild in home and sub folder like BUIL, BUILDROOT, RPMS, SRPMS, SOURCES etc
Rpm expects to find the source tarball and any necessary patches in SOURCES; the .spec file in SPECS. When the build runs to completion, the finished rpm will be in RPMS.