How to exclude a specific file or directory from OneDrive within the OneDrive folder structure
There is no way using the UI to specify that OneDrive should not sync a specific file, filetype or folder inside the OneDrive folder structure.
Solution 1:
Update: Doesn't work anymore ¯\_(ツ)_/¯
Simply make the file both hidden and system, and OneDrive will not sync it. If it has already been synced, you'll also need to delete it online as well.
To make a file hidden and system open a command window and enter the following command:
attrib -A +S +H path\to\file\filename.ext
Note that after this change by default the file or folder will no longer be visible unless you change the relevant windows explorer setting.