The issue raised by the post primarily comes up in the context of a "National Security Letter" which is a form of administrative subpoena which a recipient is not allowed to disclose having received in many cases.
For example, the case of ACLU v. Ashcroft, linked in the question, and pertaining to Calyx Internet Access (2004), involved a National Security Letter. There was also a National Security Letter component to the Lavabit (2013) case cited in the question.
But the National Security Letter statute itself (at least as presently amended) expressly allows conferral with counsel about it. The relevant statute is 18 U.S.C. § 2709(c)(2) which provides:
(A) In general. — A wire or electronic communication service provider
that receives a request under subsection (b), or officer, employee, or
agent thereof, may disclose information otherwise subject to any
applicable nondisclosure requirement to —
(i) those persons to whom disclosure is necessary in order to comply
with the request;
(ii) an attorney in order to obtain legal advice or assistance
regarding the request; or
(iii) other persons as permitted by the Director of the Federal Bureau
of Investigation or the designee of the Director.
Even if this exception were not in the law, however, this exception would probably be implied in law, because the courts have held that National Security Letters and similar non-disclosure agreements must provide a timely opportunity for judicial review, which implicitly includes a right to counsel in the proceeding. See Under Seal v. Sessions, Slip Op. at 34-40 (9th Cir. 2017).
Similarly, a Medicaid gag rule, that prohibited people from conferring with lawyers regarding legal options for circumventing means tests for the Medicare nursing home program, were held unconstitutional. See, e.g., Zahner v. MacKereth, Civil No. 11-306 Erie (W.D. Pa. Jan. 16, 2014, not overruled or negatively treated on appeal).
There are a few tribunals, primarily the Foreign Intelligence Surveillance (FISA) Court (that provides probable cause and legality review for national security inquires) and the military commissions in Guantanamo Bay, Cuba, in which a lawyer representing a party in those tribunals must have a security clearance. But, the requirement of a security clearance to represent someone in the tribunal would not apply to pre-litigation legal counsel to review and response to the National Security Letter.