Short answer. No, not on that ground. Family Code Article 56 requires the petition to be denied where there is connivance between the parties in the commission of the act complained of. If your spouse secretly helped arrange the affair they are now citing, that connivance is itself a bar to the petition.
What the law says
Where there is connivance between the parties in the commission of the offense or act constituting the ground for legal separation
Family Code, Article 56 — Grounds for Denying Legal Separation. Read the full provision →
Connivance as a mandatory ground for denial
Article 56 lists six situations in which a court must deny a legal separation petition, and it phrases the instruction as mandatory: the petition for legal separation shall be denied on any of the following grounds. The third of those is where there is connivance between the parties in the commission of the offense or act constituting the ground for legal separation. Connivance means the accusing spouse did not simply discover the act after the fact, but actively participated in bringing it about, whether by arranging it, encouraging it, or otherwise setting the stage for it to happen.
Why the law refuses relief here
Legal separation exists to give relief to a genuinely aggrieved spouse over a real breach of the marriage. A spouse who secretly helped engineer the very act they now point to is not the aggrieved party the remedy is built for; they contributed to creating the ground they are asking the court to act on. That is distinct from consenting to an act after being told about it in advance, or forgiving it once it happened, both of which are separate grounds under the same article. Connivance specifically concerns a hand in causing the act to occur in the first place.
What this depends on
Whether connivance actually occurred is a question of fact, and proving that your spouse secretly helped arrange the affair, rather than simply learning of it later, is what a court would need to be satisfied of before this ground applies. Evidence of the spouse's own conduct in bringing the situation about is what matters here, not just suspicion or the timing of events. Even where connivance is not established, the same article lists other grounds, such as condonation or consent, that could independently bar the petition depending on what actually happened between you.
Connivance versus collusion
Article 56 separately lists collusion between the parties to obtain a decree as another bar to a petition, and it is worth not confusing the two. Connivance concerns a hand in bringing about the underlying act, such as arranging the affair itself, while collusion concerns the parties cooperating to manufacture or fabricate a case for the court, whether or not the underlying ground actually happened. Raising connivance as your defense means pointing to what your spouse did before or during the affair, not to any agreement between you two about how the litigation itself would be run.