RAW
By a strict reading of RAW, you can't use the ability. This would be the same as casting Hold Person on a disguised Vampire.
The rules are not clear on what happens when you cast a spell using the "wrong" target. Typically this is ruled as the spell being cast, but failing to have an effect. Alternatively, the caster might simply be told that the spell cannot be cast on that target.
House Rulings
What should happen is a more interesting question.
We can rule out the caster's awareness as a factor. It sets a bad precedent to give characters an advantage for being willfully ignorant. In addition, as a non-illusion spell, it doesn't make a lot of sense for the caster's perception to be a part of its "physics."
The RAW version is functional, but there is another alternative: The caster creates the non-magical components of the object, but is unable to capture anything of a magical nature.
For example, if you copied a golden statuette of a bird with magically flapping wings, you'd end up with a mundane, unmoving statuette.
Illusions
Illusions are an interesting side case in this scenario. An illusion can be an image of a legal object, and it makes some sense that you could use the ability to copy something simple (such as a chair) you had seen an illusion of.
On the other hand, illusions can just as easily include fantastic elements beyond the scope of this ability.
Therefore, it is probably safest to just rule out things that have been seen in illusory form. Either because they are not objects, or because they are magical.