I tried one of the ones that clamps onto the seatpost, it did not stay where I wanted it. But I was not using a rack, if I had a rack I could probably have attached the fender under the rack with a ziptie or something like that. This would not keep road grime off the front derailleur (none on the bike shown in photo) or bottom bracket area, so if that is important to you, then this is not the solution.
I do not recall the brand or model of fender with certainty, but I think it was a Toppeak.
TopeakŪ Cycling Accessories ? Products - DeFender? RX