If you're sure you dont want to match at the program, and would in fact rather not match at all than go there, there's no sense in going to the interview. Cancel it (it's very rude to just not show up at the interview) and withdraw your app. Don't waste your time or the time of the people at the program with an interview if you have no intention of ending up there.
If you decide after interviewing somewhere that you hate it so much that you wouldn't want to match there and would rather not match at all, then yes you can just choose not to list it on your rank list. You don't need to withdraw at that point. They won't know you didn't rank them.
If you didn't like the program that much but would still rather work there than go without a residency spot, then just rank it last on your match list.
Personally, I think that unless you see something very seriously wrong on match day (like the interviewers there are very malignant or residents actually warn you not to go there) then in most circumstances you probably should rank every place you interview - just rank the least favorite last, of course.