I’m not just talking about the published guidelines. If the agency says they don’t take fantasy, don’t send them your latest elf-masterpiece; convinced it’s so good they’ll want to reconsider.
Agents and publishers state their preferences for a reason. You’re wasting their time if you ignore them.
Similarly, know the unwritten rules. That Sci-Fi publisher doesn’t need to tell you not to send romance. If you did your homework, you’d already know.