It doesn't say.
This spell talks about creatures in the same area:
Creatures of the specified kind or alignment feel elated and pleased
to be in the area or desire to touch or to possess the object. The
compulsion to stay in the area or touch the object is overpowering. If
the save is successful, the creature is released from the enchantment,
but a subsequent save must be made 1d6×10 minutes later. If this save
fails, the affected creature attempts to return to the area or object.
Emphasis mine. Check this out:
creatures of the specified kind or alignment feel elated and pleased
to be in the area.
If there are creatures in the same area of the target, they get the funny feelings. What is, however, this "area"?
The spell's description don't say out loud, but I presume this refers to the immediate vicinity of the target - the same room, hall, or clearing. I would assume that the creature must even see the target, at least once, to become attracted to it (or at least, detect it using it's senses). If the creature is able to detect the target, it is affected. If it can't, it is not.
If this save fails, the affected creature attempts to return to the area or object.
This spell have no effect on something that is outside the area defined by the first clause. If the area on which the target is in is a room, people outside the room won't be affected, however once they enter it, they will feel the effects of this spell.
This is, in a way, not really different from Bardic Music. Bardic Music works on everybody¹ that can detect the bard's performance - can hear him if he sings, or can see him if he dances. Creatures must "detect" the bard's perfomance to be affected.
I would rule that this spell would work on a similar fashion. Cast Simpathy on a animated harp, and everybody that can hear it would be affected. Cast it on a paiting, and everybody that can see the paiting would become affected.
Anyway, this is fertile ground for DM Fiat, so YMMV. Check it with your DM to be sure! If you are the DM, well... this spell is one of those open-ended rules that have the potential to become really, really fun. Use it wisely!
¹ Not really everybody, but you get the point.