Sent from my Oneplus One using XDA Free mobile app
If any system files were altered with root, they need to be restored to stock to get OTA. RUU (available for AT&T version) back to stock is probably the best way to get it close to stock as possible.
Also, you need to tell the buyer the phone is s-off, as selling an s-off phone to an unsuspecting buyer is not a good idea (also that it was bootloader unlocked, even if returned to LOCKED).
Doesn't matter if the phone is rooted or not, the RUU will still run.
Bootloader needs to be locked or relocked for the RUU to run, unless you are s-off (RUU will not run with bootloader unlocked).
Of course, the RUU also needs to be the right carrier version (CID), and you can't "downgrade" or run a former RUU version than is on the phone (these restrictions are also bypassed by s-off).
Those are basically the only restrictions on running RUU.
There have been some isolated incidents on other devices where mods caused issues with RUU; so this may be what you have read. For instance, on the One X (EVITA) the Jellybean RUU bricked the device if SuperCID was present and S-on. But this was a bug, and not typical of how RUU works (basically a rare exception to the rule). I haven't heard of any such thing on the M8.
Or you may be thinking of OTA, which is a completely different case. For OTA, stock recovery needs to be present, and if any system files were altered by root, OTA will not install (although presence of root itself will not cause it to fail). AFAIK from reports here, OTA will install whether the bootloader is locked or not.