My aunt's cat went off it's food for ages, turned out she had a respiratory infection and couldn't smell her food, and therefore didn't recognise it as food. My aunt was told to try her on something smelly like sardines and to heat them first to make them smell more. It worked. Hopefully it's a simple thing for your cat.
My vet tried to get us to try and get a urine sample from our cat by putting only a little litter in his tray so that he would use it, and then pouring off what was left. We weren't successful, he's too fussy about the tray.