The issue you describe is usually characterized as the multijurisdictional practice of law and is not terribly straightforward, in part, because the "practice of law" is not a well defined or consistently defined term.
For example, in New York, preparation of a title opinion is considered to be the practice of law, while in Colorado, it is not and title opinions are routinely prepared by non-lawyers in title companies and by a type of independent paraprofessional (with no formal licensing) known as a "landman".
As a rule of thumb:
All work involving law in a jurisdiction where you are not admitted is subject to the ethical requirement that you be actually competent to render the opinion regardless of your formal licensure, and
Normally, work involving law in a jurisdiction where you are not admitted must be incident to your representation of a client in a state where you are admitted to practice.
A leading analysis of the issues related to multijurisdictional practice is a 2002 report of the American Bar Association on the subject, much of which has been incorporated into the rules of professional ethics for attorneys of many states.
The core rule of professional conduct that was proposed and adopted in identical or similar form by many states from that report is as follows:
Rule 5.5 Unauthorized Practice Of Law; Multijurisdictional Practice Of
(a) A lawyer shall not practice law in a jurisdiction in violation of
the regulation of the legal profession in that jurisdiction, or assist
another in doing so.
(b) A lawyer who is not admitted to practice in this jurisdiction
(1) except as authorized by these Rules or other law, establish an
office or other systematic and continuous presence in this
jurisdiction for the practice of law; or
(2) hold out to the public or otherwise represent that the lawyer is
admitted to practice law in this jurisdiction.
(c) A lawyer admitted in another United States jurisdiction, and not
disbarred or suspended from practice in any jurisdiction, may provide
legal services on a temporary basis in this jurisdiction that:
(1) are undertaken in association with a lawyer who is admitted to
practice in this jurisdiction and who actively participates in the
(2) are in or reasonably related to a pending or potential proceeding
before a tribunal in this or another jurisdiction, if the lawyer, or a
person the lawyer is assisting, is authorized by law or order to
appear in such proceeding or reasonably expects to be so authorized;
(3) are in or reasonably related to a pending or potential
arbitration, mediation, or other alternative resolution proceeding in
this or another jurisdiction, if the services arise out of or are
reasonably related to the lawyer's practice in a jurisdiction in which
the lawyer is admitted to practice and are not services for which the
forum requires pro hac vice admission; or
(4) are not within paragraphs (c) (2) or (c)(3) and arise out of or
are reasonably related to the lawyer's practice in a jurisdiction in
which the lawyer is admitted to practice.
(d) A lawyer admitted in another United States jurisdiction or in a
foreign jurisdiction, and not disbarred or suspended from practice in
any jurisdiction or the equivalent thereof, or a person otherwise
lawfully practicing as an in-house counsel under the laws of a foreign
jurisdiction, may provide legal services through an office or other
systematic and continuous presence in this jurisdiction that:
(1) are provided to the lawyer's employer or its organizational
affiliates, are not services for which the forum requires pro hac vice
admission; and when performed by a foreign lawyer and requires advice
on the law of this or another U.S. jurisdiction or of the United
States, such advice shall be based upon the advice of a lawyer who is
duly licensed and authorized by the jurisdiction to provide such
(2) are services that the lawyer is authorized by federal or other law
or rule to provide in this jurisdiction.
(e) For purposes of paragraph (d):
(1) the foreign lawyer must be a member in good standing of a
recognized legal profession in a foreign jurisdiction, the members of
which are admitted to practice as lawyers or counselors at law or the
equivalent, and subject to effective regulation and discipline by a
duly constituted professional body or a public authority; or,
(2) the person otherwise lawfully practicing as an in-house counsel
under the laws of a foreign jurisdiction must be authorized to
practice under this rule by, in the exercise of its discretion, [the
highest court of this jurisdiction].
The meaning of the rule quoted above is discussed in official and unofficial commentary beginning at page 19 of the ABA Report.