I have seen both these sentences used but don't see any obvious difference. Could you please explain in what situations one is preferable to the other.
"I don't know" is just a statement of fact. "I wouldn't know" is often used when the speaker has no logical reason to know, for example, "I wouldn't know, I don't work here".
Sometimes it just comes down to regional differences though; here in Ireland, for example, it's quite common to hear people say "I wouldn't know" when they really just mean "I don't know".
"I don't know" simply asserts lack of knowledge.
"I wouldn't know" usually also implies that there is some reason why the person is the wrong person to ask a question of that sort.
"Can you tell me where the nearest Chase Bank branch is?"
"I wouldn't know. I'm visiting from Iceland."*
"I wouldn't know" is also sometimes used in contexts where the speaker wants to emphasize that it isn't a subject with which they have any acquaintance. In effect, it says "I don't know that and I am not the kind of person who knows that sort of thing." There is a distancing of the speaker from information of that type. It is often used this way in popular culture.
From "Downton Abbey" Episode 4.5:
Isobel Crawley: How you hate to be wrong.
Violet Crawley, Dowager Countess of Grantham: I wouldn't know, I'm not familiar with the sensation.
Or, if you ask a politician what the prices are like at the local brothel, he might respond "I wouldn't know" to indicate that it isn't just that he has forgotten or happens not to know, but that he would never be in a position to know such a thing.
Similarly, a witness being questioned by a police detective about the actions of a dangerous criminal might reply to her, "I wouldn't know," meaning that it is the witness's policy to avoid being acquainted with such matters (or at least to pretend to) and so in this case or others like it, he won't be a useful source of information.
Something like the latter occurs repeatedly in the Lecrae song "I Wouldn't Know," for example:
I done seen things I don't wanna see
I'm out runnin' through the streets
Heard somebody callin' me and sayin' we should meet
But I wouldn't know
It can also indicate contempt or bitterness regarding the person or thing the question was about.
Customer: "Is the Paul Masson blush or the Gallo rosé sweeter?"
Wine Steward: "I wouldn't know, Sir."*
Leonardo DiCaprio to the Oscar trophy engraver: "Do you do this every year? I wouldn't know."
(* = my own illustrations)