Apple's warranty (Standard or AppleCare) is NOT voided when any replacement part is used, provided that the part is installed by an Apple Authorized Technician. Any dissuasion that Apple may attempt is only to dissuade one from buying third party hardware, or attempting to access the support or warranty services on the third party hardware.
That being said, the Apple warranty will not cover the installed hardware. A new hard drive (for instance) would only be covered by the manufacturer's warranty, and not Apple's.
An Apple Store may refuse to do such installation because it's owned by the company itself, and they have to uphold the above reasoning. An independent Apple Technician will likely be happy to perform the install. I work at an Apple Reseller/Service Provider, and the tech has installed numerous third party hard drives, optical drives, memory, screens, etc. while the machine was still under warranty. Most often, it's done because Apple will not cover the problem (Drops, Spills, etc.), but it is also done as part of an upgrade path.
Don't always believe what Apple tells you over the phone. The customer service end has been known to misstate facts (due to sheer ignorance, more than anything) concerning Apple's actual policies and protocols. The solution? Talk to a third party Apple Authorized Service Provider. They have to know the policies, and don't much care whether you want to buy your hardware from Apple, or third parties, because they sell it all the same.