
916 So.2d 977 (2005)
PAPA JOHN'S INTERNATIONAL, INC., a Delaware corporation, Appellant,
v.
James COSENTINO, individually, Appellee.
No. 4D04-4864.
District Court of Appeal of Florida, Fourth District.
December 28, 2005.
*979 John T. Houchin, Hunton & Williams LLP, Miami, and Michael J. Lockerby, Hunton & Williams LLP, Richmond, VA, for appellant.
Robert Zarco, Robert M. Einhorn, and Himanshu M. Patel of Zarco Einhorn Salkowski & Brito, P.A., Miami, for appellee.
GROSS, J.
Papa John's International, Inc., appeals a final judgment arising from an order granting a motion to dismiss under Florida Rule of Civil Procedure 1.140. We reverse.
This litigation arises from a substantial franchise deal for the development of Papa John's restaurants in New York. The terms of the deal were set forth in a series of contracts. The parties to those contracts were: (1) the franchisor, Papa John's International, Inc.; (2) the franchisee/developer, Dynamic Pizza Corporation; and (3) James Cosentino, the sole shareholder of Dynamic Pizza.
In reviewing an order granting a motion to dismiss, this court's "gaze is limited to the four corners of the complaint." Gladstone v. Smith, 729 So.2d 1002, 1003 (Fla. 4th DCA 1999). The facts alleged in the complaint must be accepted as true and all reasonable inferences are drawn in favor of the pleader. See id.
The complaint alleges that in September, 1996, Papa John's entered into a development agreement with Dynamic Pizza, one of many corporations solely owned by Cosentino. Pursuant to that agreement, Dynamic Pizza agreed to develop 40 Papa John's restaurants in New York state. To that end, the parties executed a number of additional contracts, including multiple franchise agreements and an owner agreement.[1]
One of the issues in this case is whether Cosentino is bound by the owner agreement in his individual capacity. That agreement provides, in pertinent part:
OWNER AGREEMENT
In consideration of, and as a condition to the granting by PAPA JOHN'S INTERNATIONAL, INC. ("we" or "us") of a Development Agreement . . . and all Franchise Agreements executed pursuant to its terms (collectively the "Agreements") providing certain rights relating to one or more of Papa John's Restaurants (the "Restaurants") to DYNAMIC PIZZA, INC. ("Franchisee"), each of the undersigned individuals ("you"), who are a beneficial owner of an interest in the Franchisee, hereby covenant and agree to be bound by the terms and *980 restrictions of this Owner Agreement. . .
1. Acknowledgments. Each of you, jointly and severally, represent and warrant to us:
(a) That you are the owners of all equity, voting, and other ownership interests in the Franchisee . . .;
(b) Franchisee is duly organized and validly existing in good standing under the laws of the State of New York . . .;
(c) It is a condition to the granting of the franchise to the Franchisee that you enter into this Owner Agreement and we have entered into the Agreements in reliance upon your agreement to do so, and will continue to do so. . . .
2. Confidentiality and Non-Competition Agreements.

(a) Covenant Not-to-Compete. Each of you covenants and agrees that during the period Franchisee owns one or more Papa John's Restaurants . . . and for a period of two years after . . . you shall not, within a 10-mile radius . . . [compete with Papa John's]. . . .
3. Guaranty.

(a) Guaranty. Each of you personally and unconditionally guaranty to us and to our Affiliates . . . the punctual payment when due of all sums . . . which Franchisee may now or in the future might owe to any member of Our Group. . .; provided the maximum aggregate liability of each of you shall not exceed $300,000.

(b) Covenants and Acknowledgements. Each of you covenant and agree that: (1) liability under this guaranty shall be joint and several; (2) that this is a guaranty of payment and not of collection. . .; [and] (3) this guaranty shall extend to all amounts you may now or in the future owe any member of our Group, whether pursuant to the Agreements, another agreement with us or otherwise . . .
(Emphasis added).
Following this language, the owner agreement included two sequential signature blocksone for the "owner" and another for the "principal operator," if that principal operator is not an owner.
The first signature block was prefaced with the following language, "IN WITNESS WHEREOF, each of you have signed this Owner Agreement on the date set forth opposite your signature."
The second signature block was prefaced differently. It stated:
TO BE COMPLETED IF PRINCIPAL OPERATOR IS NOT AN OWNER.
I represent and acknowledge that I am the Principal Operator of a Restaurant and that I agree to be bound by the provisions of Section 2 of this Owner Agreement and, at such time as I become an Owner . . . to be fully bound by this Agreement without any need for further action of reexecution of this Agreement.
Cosentino signed both signature blocks, giving the same address under both signatures.
Papa John's complaint explains the events that followed the execution of this first batch of documents:
12. After Cosentino and Dynamic Pizza executed the Development Agreement and the Owner Agreement, Dynamic Pizza opened only 19 Papa John's pizza restaurant less than one-half of the 40 restaurants required by the Development Agreement.
13. Dynamic Pizza was unable to open the number of restaurants required by the Development Agreement because, among other things, the Dynamic Pizza companies were undercapitalized. Indeed, in order to keep the Dynamic Pizza *981 companies operating, Cosentino had to take out numerous additional loans and take money from his other operating companies to put it into the Dynamic Pizza companies. These sums totaled approximately seven million five hundred thousand ($7,500,000) in additional capitalization.
14. Thereafter, disputes arose between Dynamic Pizza and Papa John's. In an effort to resolve the disputes, Dynamic Pizza, Cosentino, and Papa John's executed a Workout Agreement . . . and. . . also executed an Addendum to the Workout Agreement. . . .
15. Pursuant to the terms of the Workout Agreement, Dynamic Pizza's obligation to develop Papa John's restaurants was decreased from 40 restaurants to 19 restaurants.
16. As part of the Workout Agreement, Dynamic Pizza and Cosentino executed and delivered a Promissory Note in the principle amount of two hundred ten thousand dollars ($210,000). . . .
The workout agreement, promissory note, and addendum referenced in these paragraphs were all attached to the complaint. Section 7(a) of the workout agreement included a choice of law and choice of forum clause, requiring the application of Kentucky law in a Kentucky court for disputes arising under its terms. Section 7(b) of the workout agreement contained a superiority clause, stating that it shall control over "any other preceding agreement between the parties. . . ." As this clause indicates, the parties' initial agreements remained intact to the extent they were not contradicted by the workout agreement. Cosentino signed the workout agreement twice, once on behalf of Dynamic Pizza and again in his individual capacity. Cosentino signed the promissory note, which was referenced in, and attached to, the workout agreement, in the same way.
Shortly after signing the workout agreement and promissory note, the parties executed an addendum. The purpose of the addendum was to make clear that the $210,000 promissory note Cosentino executed did not increase his maximum aggregate liability of $300,000 under the owner agreement. The addendum stated, in pertinent part:
2. James Cosentino has previously agreed to guaranty an aggregate amount of $300,000 in respect to the obligations of the Developer. It is intended that the extent of the guaranty of James Cosentino not increase by his execution of the Promissory Note. To accomplish this agreement, the following provision is hereby added to the end of Section 4 of the Workout Agreement:
Shareholder has executed one or more guarantees in favor of Papa John's under which Shareholder is obligated to Papa John's for up to the aggregate amount of $300,000 (the "Guarantees"). Any payment of principle [sic] or interest made by the Developer or Shareholder to Papa John's or its affiliates in connection with the Promissory Note shall be considered to be paid pursuant to the Guarantees signed by the Shareholder, and shall reduce the amount which Shareholder would otherwise be liable to Papa John's or its affiliates in connection with the Guarantees.
As with the owner agreement, workout agreement, and promissory note, Cosentino signed the addendum twice, with one signature being in his individual capacity.
Another issue in this case is whether the trial court properly entered dismissal on the theories of res judicata or collateral estoppel based on a prior case between the same parties in a Kentucky federal district *982 court. The complaint vaguely described the Kentucky case:
17. Later, additional disputes arose between the parties. As a result, Papa John's sued the Dynamic Pizza companies and Cosentino [in Kentucky federal court] for breach of contract and breach of the Owner Agreement, Development Agreement, Franchise Agreements, and Workout Agreement.
18. On May 20, 2004, the United States District Court for the Western District of Kentucky entered a Consent Final Order and Judgment in favor of Papa John's and against the Dynamic Pizza companies owned by Cosentino jointly and severally [among Cosentino's companies] in the amount of one million five hundred thousand dollars ($1,500,000) on Papa John's breach of contract claim. . . .
Attached to the complaint was a copy of the consent final order and judgment rendered by the Kentucky federal district court. That order provided:
CONSENT FINAL ORDER AND JUDGMENT
UPON CONSIDERATION of the parties' joint motion for entry of a Consent Final Order and Judgment . . . the Court hereby ORDERS, ADJUDGES, and DECREES as follows:
(1) Judgment is hereby entered in favor of [Papa John's] and against Defendants Dynamic Pizza [and its affiliates], jointly and severally, in the amount of One Million Five Hundred Thousand Dollars ($1,500,000) on Plaintiff's claim for breach of contract;
(2) Plaintiff [Papa John's] claim for breach of contract against Defendant James A. Cosentino under the Owner's Agreement, including the terms of the Development Agreement and Franchise Agreements incorporated by reference, and as amended by Paragraph 7(a) of the Workout Agreement, is DISMISSED WITHOUT PREJUDICE;
(3) Defendants' counterclaims for breach of contract and breach of the covenant of good faith and fair dealing are DISMISSED WITH PREJUDICE; and
(4) Except as otherwise provided herein and in prior orders of this Court, all claims that were asserted or could have been asserted in this action are hereby DISMISSED WITH PREJUDICE. . . .
Based on the foregoing facts, Papa John's complaint asserted three counts. Count I alleged breach of the $210,000 promissory note, asserting that Dynamic Pizza and Cosentino both failed to make the required payments. This count sought $210,000 in compensatory damages, plus attorney's fees and costs.
Count II alleged breach of the guaranty provisions of the owner agreement, claiming that "Cosentino personally and unconditionally guaranteed Dynamic Pizza's payment obligations to Papa John's up to a maximum amount of $300,000 per Franchise Agreement," an obligation Cosentino had confirmed when executing the addendum to the workout agreement.
Count III alleged a claim for piercing the corporate veil, asserting that the Dynamic Pizza companies were Cosentino's alter egos, which Cosentino created to "evade liability for the debts and liabilities of the undercapitalized Dynamic Pizza companies."
Cosentino responded with a motion to dismiss, arguing that: (1) all of Papa John's claims were barred by res judicata and/or collateral estoppel; (2) Cosentino was not personally liable under the owner agreement; and (3) count III failed to state a cause of action for piercing the *983 corporate veil. Filed with the motion in support of his res judicata and collateral estoppel arguments, was a copy of Papa John's six count complaint from the Kentucky case.
The circuit court granted Cosentino's motion to dismiss Papa John's complaint. The court's order indicated that: (1) all of Papa John's claims under the promissory note and workout agreement were previously resolved by the consent order entered in the Kentucky case; (2) Cosentino did not sign the guaranty in the owner agreement in his individual capacity; and (3) Papa John's failed to sufficiently plead a claim for piercing the corporate veil. To reach these conclusions, the court took "judicial notice of the Kentucky case."
Res judicata and collateral estoppel are affirmative defenses. If the face of the complaint contains allegations which demonstrate the existence of an affirmative defense, then such a defense may be considered on a motion to dismiss. See Fla. R. Civ. P. 1.110(d); Palmer v. McCallion, 645 So.2d 131, 133 (Fla. 4th DCA 1994); Vaswani v. Ganobsek, 402 So.2d 1350, 1351 (Fla. 4th DCA 1981). Otherwise an affirmative defense may not be considered on a rule 1.140(d) motion to dismiss. See Swafford v. Schweitzer, 906 So.2d 1194, 1195 (Fla. 4th DCA 2005).
This court has followed the general rule that a court may not look beyond a complaint and its attachments to take judicial notice of a separate legal proceeding when ruling on a motion to dismiss. For example, in Norwich v. Global Financial Associates, 882 So.2d 535, 537 (Fla. 4th DCA 2004), we wrote that "[w]hile the defenses of res judicata and collateral estoppel may be resolved through a motion for summary judgment, the trial court erred when it ventured outside the four corners of the complaint, took judicial notice of the final judgment of dissolution of marriage, and dismissed the complaint with prejudice." See also United Servs. Auto. Ass'n v. Selz, 637 So.2d 320, 321 (Fla. 4th DCA 1994), disapproved on other grounds by E.C. v. Katz, 731 So.2d 1268 (Fla.1999); Kest v. Nathanson, 216 So.2d 233, 236 (Fla. 4th DCA 1968); Lucas v. Davidson, 624 So.2d 865, 866 (Fla. 2d DCA 1993); Livingston v. Spires, 481 So.2d 87 (Fla. 1st DCA 1986).
For this reason, the circuit court erred by going beyond the four corners of the complaint and taking judicial notice of the Kentucky complaint when ruling on Cosentino's motion to dismiss. The trial court's order of dismissal may be upheld only if the defenses of res judicata or collateral estoppel appear on the face of the complaint.
Because the Kentucky judgment was rendered by a federal court, we apply federal claim preclusion principles to evaluate its effect on the Florida lawsuit. See, e.g., Dalbon v. Women's Specialty Retailing Group, 674 So.2d 799, 800 (Fla. 4th DCA 1996); Andujar v. Nat'l Prop. & Cas. Underwriters, 659 So.2d 1214, 1216 (Fla. 4th DCA 1995); Amador v. Fla. Bd. of Regents ex rel. Fla. Int'l Univ., 830 So.2d 120, 121-22 (Fla. 3d DCA 2002); O'Brien v. Fed. Trust Bank, F.S.B., 727 So.2d 296, 297 (Fla. 5th DCA 1999); Agripost, Inc. v. Miami-Dade County, 195 F.3d 1225, 1230 n. 11 (11th Cir.1999) (recognizing that a "Florida court would look to federal claim preclusion law in determining whether to give [a] former federal judgment preclusive effect").
Under federal law, the "doctrine of res judicata, or claim preclusion, bars the filing of claims which were raised or could have been raised in an earlier proceeding." Citibank, N.A. v. Data Lease Fin. Corp., 904 F.2d 1498, 1501 (11th Cir.1990). Res judicata applies where the following *984 four elements exist: "`(1) the prior decision was rendered by a court of competent jurisdiction; (2) there was a final judgment on the merits; (3) the parties were identical in both suits; and (4) the prior and present causes of action are the same.'" Id. (quoting Israel Disc. Bank Ltd. v. Entin, 951 F.2d 311, 314 (11th Cir.1992)).
The circuit court erred in dismissing counts I and II of the complaint because that pleading does not demonstrate on its face that the Kentucky consent order was a final judgment on the merits for these claims.
A number of federal courts have recognized that "[t]he effect of a voluntary dismissal without prejudice is to render the proceedings a nullity and leave the parties as if the action had never been brought." E.g., In re Piper Aircraft Distrib. Sys. Antitrust Litig., 551 F.2d 213, 219 (8th Cir.1977). As such, "[n]either res judicata nor collateral estoppel is traditionally applicable to a voluntary dismissal." Id.; see generally E.H. Schopflocher, Provision That Judgment Is "Without Prejudice" Or "With Prejudice" As Affecting Its Operation As Res Judicata, 149 A.L.R. 553 (1944). For this reason, the portion of the consent order dismissing Papa John's claim in the Kentucky complaint for breach of the "Owner[] Agreement . . . WITHOUT PREJUDICE" does not qualify as a final judgment on the merits for the purpose of a res judicata analysis. Without a final judgment, the trial court erred to the extent it dismissed count II of Papa John's complaint on res judicata grounds that claim was based on the personal guaranty provisions contained in the owner agreement.
The effect of the Kentucky consent order on count I of Papa John's complaint is not apparent from the face of the complaint and its attachments. The consent order did not expressly preserve Papa John's right to pursue a claim based on the promissory note; in fact, the order did not reference the promissory note at all. Paragraph (2) of the order mentioned section 7(a) of the workout agreement (to which the promissory note was attached), but that section is a choice of law/choice of forum clause. It is unclear whether an action on the promissory note falls under the dismissal without prejudice in paragraph (2) or the catch-all language of paragraph (4), which states that all other claims are dismissed with prejudice "except as otherwise provided herein." This ambiguity precludes dismissal of count I of Papa John's on res judicata grounds, because it does not appear on this record that there was a final judgment on the merits covering the claim based on the promissory note.
Just as the absence of a final judgment on the merits precluded dismissal of counts I and II on res judicata grounds, so does it prevent dismissal under the doctrine of collateral estoppel, or issue preclusion, which also requires the existence of "a final judgment on the merits" as a necessary element. See Citibank, 904 F.2d at 1501.
The circuit court also erred in its alternative ground for dismissing count IIthat Cosentino did not sign the guaranty provisions of the owner agreement in his individual capacity.
The unambiguous language[2] of the owner agreement demonstrates that Cosentino signed the ownership agreement as an individual. One of the defined terms included in the owner agreement was the word "you," which was defined as "each of the *985 undersigned individuals." (emphasis added). The owner agreement went on to say,
Each of you personally and unconditionally guaranty to us and to our Affiliates. . . the punctual payment when due of all sums . . . which Franchisee may now or in the future might owe to any member of Our Group . . .; provided the maximum aggregate liability of each of you shall not exceed $300,000.
Cosentino signed that agreement twice, making him the only "undersigned individual" who agreed to the personal guaranty provision. Cosentino signed the agreement as both an owner and an operator, but also acknowledged in the recitals section that he was the "owner[] of all equity. . . in the Franchisee." This construction of the agreement is consistent with common sense. The purpose of the guaranty was to ensure that if the corporate franchisee failed to pay its obligations to Papa John's, then Papa John's had recourse against a third party. The nonsensical reading of the owner agreement that persuaded the circuit courtthat Cosentino signed the agreement in his capacity as an officer of Dynamic Pizzawould mean that Papa John's obtained a guaranty from the same corporation whose debts it was seeking to secure.
Having reversed the dismissal of counts I and II, we also reverse the dismissal of count III for piercing the corporate veil. To the extent that the court ruled that the allegations of the complaint were deficient for failing to allege improper conduct or that the companies were "mere instrumentalities," Papa John's should be given leave to amend.
Reversed and Remanded.
STONE and HAZOURI, JJ., concur.
NOTES
[1]  The development agreement and the franchise agreements were not attached to the complaint; however, the owner agreement was attached and must therefore be considered as though fully alleged in the pleading. See Fla. R. Civ. P. 1.130(b).
[2]  Both sides contended at oral argument that the agreements were clear on their face.
