Duncan did play an unwitting part in his own murder, because he was not aware of Macbeth’s true character. He walked right into a trap, going to Macbeth’s castle and leaving himself relatively unguarded. He was a poor judge of character, and paid a high price. However, Duncan is not entirely to blame because he did not know Macbeth well.
Duncan says Macbeth is “a gentleman on whom I built/An absolute trust” (enotes etext pdf p. 17).
When Macbeth is promoted to Thane of Cawdor, Duncan comments to Macbeth not only about how highly he thinks of him, but how he feels bad about not promoting him sooner.
The sin of my ingratitude even now
Was heavy on me. Thou art so far before,
That swiftest wing of recompense is slow(20)
To overtake thee. (p. 17)
When Duncan goes to Inverness, Macbeth’s castle, he is putting himself at risk because he simply does not realize that Macbeth is angry about not being named his successor.
So should Duncan have known? He should have, possibly, but he does not have seemed to have known Macbeth well even though they are related. He most likely knows him from a distance. Has he been to Inverness before?
In Scene 4, Duncan tells Macbeth that by going to his home, he will bind himself to Macbeth.
But signs of nobleness, like stars, shall shine
On all deservers. From hence to Inverness,
And bind us further to you. (p. 18)
This seems to indicate that he does not already know Macbeth well, and is planning to get to know him better now that he has a higher title. When he shows up, he comments to Banquo that he likes the castle.
This castle hath a pleasant seat; the air
Nimbly and sweetly recommends itself
Unto our gentle senses. (p. 21)
So although Duncan should have been more careful, he might not have known Macbeth well enough to realize that he was a threat.