I don't know how dropbox has actually implemented this, and I'm not sure about OSX,
But on windows you might use a kernel file system filter driver or a shell namespace extension:
https://msdn.microsoft.com/en-us/library/windows/desktop/cc1...
This looks like an open source project that provides something similar for google drive: https://github.com/google/google-drive-shell-extension
On linux this could probably be even easier, just mounting a directory to a remote NFS server.